cmake_minimum_required(VERSION 3.28)
project(Ns3Rti)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DELPP_THREAD_SAFE -DELPP_NO_DEFAULT_LOG_FILE -DAUTO_INITIALIZE_EASYLOGGINGPP")
set(CMAKE_CXX_STANDARD 11)

add_subdirectory(lib)

include_directories(
        ~/RTI-1.3NGv6/Linux-os-opt-mt/include
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/include)
link_directories(~/RTI-1.3NGv6/Linux-os-opt-mt/lib
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/lib)

# 设置编译完成后的输出路径
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# 使用 GLOB 获取所有不同后缀名的源文件
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.cc")

# 创建可执行文件
add_executable(ns3_rti ${SRC})

include_directories(
        lib/src/Easylogging/
        src/HwFederateAmbassador/
        src/NlohmannJson/
        lib/src/RtiHelper/
        lib/src/Utils/
)

target_link_libraries(ns3_rti RTI-NG fedtime pthread Ns3RtiLib)

